package com.hera.process.config.service.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hera.base.util.FiltroDTO;
import com.hera.process.config.dao.SecGroupModuleDao;
import com.hera.process.config.dao.SecurityGroupDao;
import com.hera.process.config.domain.ParameterDetail;
import com.hera.process.config.service.SecurityGroupService;
import com.hera.process.security.domain.SecurityGroup;

@Service("securitygroup1")
public class SecurityGroupServiceImpl implements SecurityGroupService{

	static final Logger logger = Logger.getLogger(SecurityGroupServiceImpl.class);
	
	@Autowired
	private SecurityGroupDao securitygroupdao;
	
	@Autowired
	private SecGroupModuleDao secgroupmoduledao;
	
	@Override
	public SecurityGroup findById(Long id) {
		
		return securitygroupdao.findOne(id);
	}

	@Override
	public void update(SecurityGroup entity) {
	securitygroupdao.save(entity);
	}

	@Override
	public void save(SecurityGroup entity) {
		securitygroupdao.save(entity);
	}

	@Override
	public void delete(SecurityGroup entity) {
	secgroupmoduledao.deleteBySecGroupModule(entity.getIdSecurityGroup());
		securitygroupdao.delete(entity);
	}

	@Override
	public List<SecurityGroup> findAll() {
		
		return securitygroupdao.findAll();
	}

	@Override
	public List<SecurityGroup> findAll(FiltroDTO filtroDTO) {
		
		return securitygroupdao.obtenerEntidadesPorFiltros(filtroDTO);
	}

}
